This invention relates to a header detectior capable of detecting the head of a code contained in a code sequence, and to an associated decoding apparatus.
As transmission media and storage media have been digitized, devices such as encoders and decoders have been used increasingly. For example, variable-length decoding apparatus employ a header detector capable of detecting a header code contained in an input code sequence and locating the head of a code following the header code thus detected.
A conventional header detector will now be described below. A header code used here consists of a series of n 0 bits terminated by a single 1 bit.
The operation of the conventional header detector is explained. An incoming code sequence is outputted in units of one bit. Each one bit outputted is checked for whether it is a 0 bit or a 1 bit by a comparator. An accumulator accumulates 0 bits outputted in series, and the number of such consecutive 0 bits is compared with the set value (=n). If n 0 bits are outputted in series and the subsequent bit is a 1 bit, then this bit string (i.e., 0000 . . . 0, 1) is judged to be a header code. In other words, a bit string, composed of a series of n 0 bits terminated by a single 1 bit, is a header code. Additionally,, a bit string, composed of n+1 or more 0 bits terminated by a single 1 bit, is also judged to be a header code.
If the output of the accumulator is less than n and the next bit is judged by the comparator to be a 1 bit, the accumulator is reset to zero. Each bit is outputted in synchronism with a clock signal.
The above-described conventional header detector has some drawbacks. For example, a code sequence is processed in units of one bit. In other words, when detecting a header code, the same number of clock cycles as the number of bits forming the header code is required. The speeds of a shifter and an accumulator together forming a header detector ill-influence the rate of retrieval of the header code, and the header-code retrieval rate cannot be increased.
When forming a decoder with the above-described conventional header detector, another problem is produced. Since the conventional header detector provides a code sequence in units of one bit, when shifting out a code already decoded, the same number of clock cycles as the length of the already-decoded code is required. As a result, decoding by the decoder is limited by the speed of the header detector. Therefore high-speed decoding cannot be performed.